# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-mispy
pkgname=('python2-mispy' 'python-mispy')
_pkgname=mispy
pkgver=0.5
pkgrel=6
pkgdesc='A pythonic MISP module.'
arch=('any')
url='https://pypi.org/project/mispy/#files'
license=('APACHE')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('cf9ce53b7b2596e2f5baf0c35ea6a7d478afef3e30025c07f2c5ab0657cfadaec2cd915f243ae64ae60a2374e962ed61d7393944a2e7f731894ea5f2acda43b8')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-mispy() {
  depends=('python2' 'python2-lxml' 'python2-requests')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-mispy() {
  depends=('python' 'python-lxml' 'python-requests')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

